<?php


namespace Adapter;


class Client
{
    public static function main()
    {
        $adapter = new Adapter();
        $adapter->apiRequest();
    }
}


/**
 * 被装饰对象
 * Class Adaptee
 * @package Adapter
 */
class Adaptee
{
    public function request()
    {
        echo 'original request';
    }
}

/**
 * 目标接口
 * Interface Target
 * @package Adapter
 */
interface Target
{
    public function apiRequest();
}

/**
 * 适配器
 * Class Adapter
 * @package Adapter
 */
class Adapter extends Adaptee implements Target
{

    public function apiRequest()
    {
        echo "--- start ---", PHP_EOL;
        $this->request();
        echo PHP_EOL, "---  end  ---";
    }
}


Client::main();
